package com.juc.lock;


class Book extends Object{
    // java == (C++)--
}


/**
 * @Author Zan
 * @Create 2024/5/7 19:49
 * @ClassName : LockSyncDemo
 * @Description : TODO 请用一句话描述该类的功能
 */
public class LockSyncDemo {

    Object object = new Object();
    Book b1 = new Book();

    public void m1() {
        synchronized (b1) {
            System.out.println("-------hello synchronized code block");
            throw new RuntimeException("-----exp");
        }
    }

    public synchronized void m2() {
        System.out.println("-------hello synchronized m2");
    }

    public static synchronized void m3() {
        System.out.println("-------hello synchronized m3");
    }

    public static void main(String[] args) {

    }
}
